package guo.advise;

import guo.util.R;
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

@ControllerAdvice(basePackages = "guo.controller")
public class ErrorAdvise {

    @ExceptionHandler(value = MethodArgumentNotValidException.class)
    @ResponseBody
    public R getException(MethodArgumentNotValidException e){
        System.out.println("*******************************");
        System.out.println(e.getMessage());
        return R.error();    }
}
